package com.chenfan.mcn.enums;

import com.chenfan.mcn.constant.SeparatorCst;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;

/**
 * 合作类型枚举
 * @author wulg
 * @date 2023/6/13
 */
@AllArgsConstructor
@Getter
public enum CooperationTypeEnum {


    /**
     * 线上佣金
     */
    ONLINE_STRAIGHT_COMMISSION("onlineStraightCommission", "线上纯佣"),

    /**
     * 线下佣金
     */
    OFFLINE_STRAIGHT_COMMISSION("offlineStraightCommission", "线下纯佣"),

    /**
     * 单坑
     */
    SINGLE_CASE("singleCase", "单坑"),

    /**
     * 保ROI
     */
    ROI("roi", "保ROI");

    private String code;

    private String name;

    /**
     * 是否含有
     * @param cooperationType
     * @param cooperationTypeEnum
     * @return
     */
    public static boolean contains(String cooperationType, CooperationTypeEnum cooperationTypeEnum) {
        String[] typeArray = StringUtils.split(cooperationType, SeparatorCst.COMMA);
        return ArrayUtils.contains(typeArray, cooperationTypeEnum.getCode());
    }
}
